package com.artron.mediaartron.data.callback;

import android.app.Activity;
import android.content.Context;

import com.artron.baselib.utils.ToastUtil;
import com.artron.mediaartron.ui.activity.GeneralActivity;

/**
 * Class description here
 *
 * @author doing
 * @version 1.0.0
 * @since 2017-12-04.
 */

public class PayCallback {

    public static void startFinishPage(Activity context, String orderId, boolean success, boolean notStart,
                                       boolean isFinish) {
        if (success) {
            notStart = false;
        }

        if (!notStart) {
            if (success) {
                GeneralActivity.start(context, GeneralActivity.ORDER_SUCCESS,
                        "支付成功", orderId);
            } else {
                GeneralActivity.start(context, GeneralActivity.ORDER_DETAIL,
                        "订单详情", orderId);
                ToastUtil.show("支付失败");
            }
        } else {
            if (success) {
                ToastUtil.show("支付成功");
            } else {
                ToastUtil.show("支付失败");
            }
        }

        if (isFinish) {
            context.finish();
        }
    }
}
